/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.unal.satacredito.transactions.queuewriter;

import co.edu.unal.satacredito.transactions.queuewriter.entity.TransactionPojo;
import java.io.IOException;
import java.util.Date;
import javax.jms.QueueSender;
import org.bson.types.ObjectId;

/**
 *
 * @author oscardu
 */
public class mainCLass {

    public static void main(String[] args) throws IOException {
        TransactionPojo transaction;
        QueueWriter qw = new QueueWriter();
        QueueSender sender = QueueWriter.OpenQueueConnection();
        try {
            if (sender != null) {
                for (int i = 0; i < 100; i++) {
                    transaction = new TransactionPojo();
                    transaction.setCardNumber("6016607113769849");
                    transaction.setCardType(1);
                    transaction.setFileId(new ObjectId());
                    transaction.setFranchise(new ObjectId());
                    transaction.setLastname("Dussan Garcia");
                    transaction.setMiddlename("Andres");
                    transaction.setName(i + "Oscar");
                    transaction.setNin("1110470707");
                    transaction.setNinType(1);
                    transaction.setPurchaseAmount(350000);
                    transaction.setPurchaseDate(new Date());
                    transaction.setPurchaseDetail("Compra de un articulo");
                    //transaction.setTransactionId(new ObjectId());
                    QueueWriter.SendToQueue(sender, transaction);
                }
            }
        } catch (Exception e) {
            System.out.println("Error: "+e);
        } finally {
            qw.CloseQueueConnection();
        }
    }
}
